<template>
	<view class="page">
		登录

		<view v-show="fixed" class="fixed">
			回到顶部
		</view>
	</view>
</template>


<script setup>
	import {
		ref
	} from "vue";
	import {
		onLoad,
		onPullDownRefresh,
		onReachBottom,
		onPageScroll
	} from "@dcloudio/uni-app";

	onLoad((e) => {
		console.log("~~~onLoad函数被执行");
		console.log(`~~~ name=${e.name},sex=${e.sex}`);
	});

	onPullDownRefresh(() => {
		console.log("~~~onPullDownRefresh函数被执行");
		uni.showNavigationBarLoading();
		uni.showLoading({title: "加载中"});
		setTimeout(() => {
			uni.hideNavigationBarLoading();
			uni.hideLoading();
			uni.showToast({title: "加载成功"});
			uni.stopPullDownRefresh();
		}, 2000)
	});

	onReachBottom(() => {
		console.log("~~~onReachBottom函数被执行");
	});

	const fixed = ref(false);
	onPageScroll((e) => {
		// console.log(e.scrollTop);
		fixed.value = e.scrollTop > 200;
	});
</script>


<style lang="scss" scoped>
	@use 'index.scss';
</style>